<%-- 
    Document   : update
    Created on : Jun 20, 2012, 7:01:32 AM
    Author     : karuna
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
   <%@page import="java.sql.*,java.io.*" %>
  <%
          Class.forName("oracle.jdbc.driver.OracleDriver");

         Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","pac","mca"); 

         Statement stmt=con.createStatement();
         String student_name=request.getParameter("student_name");
    
           String student_id=request.getParameter("student_id"); 
            String college_code=request.getParameter("code");
            String course=request.getParameter("course"); 
           String ssc=request.getParameter("ssc");
           String ssc_year=request.getParameter("ssc_year");
           String  inter=request.getParameter("inter");     
         String  inter_year=request.getParameter("inter_year");    
          String  graduation=request.getParameter("graduation");
          String  graduation_year=request.getParameter("graduation_year");
          String  pg=request.getParameter("pg");       
           String pg_year=request.getParameter("pg_year");
          String technical_skills=request.getParameter("technical_skills");
          
           String mobile=request.getParameter("mobile");
           String email=request.getParameter("email");                       
         String student_uname="";
         String student_pwd="";
 PreparedStatement pstmt1=con.prepareStatement("UPDATE student_details SET student_mobile=?, student_email = ?  WHERE student_id ='"+student_id+"'");
    pstmt1.setString(1,email);
     pstmt1.setString(2,mobile);
     pstmt1.executeUpdate();
  PreparedStatement pstmt2=con.prepareStatement("UPDATE student_marks SET ssc=?,ssc_year=?,inter=?,inter_year=?,graduation=?,graduation_year=?,pg=?,pg_year=?,technical_skills=?  WHERE student_id ='"+student_id+"'");
 
            pstmt2.setString(1,ssc);
            pstmt2.setString(2,ssc_year);
             pstmt2.setString(3,inter);
             pstmt2.setString(4,inter_year);
             pstmt2.setString(5,graduation);
              pstmt2.setString(6,graduation_year);
              pstmt2.setString(7,pg);
              pstmt2.setString(8,pg_year);
              pstmt2.setString(9,technical_skills);
            
   pstmt2.executeUpdate();
  PreparedStatement pstmt3=con.prepareStatement("UPDATE student_register SET student_name=?, course = ?  WHERE student_id ='"+student_id+"'");
 
            pstmt3.setString(1,student_name);
            pstmt3.setString(2,course);
            
   pstmt3.executeUpdate();
   ResultSet rs4=stmt.executeQuery("SELECT student_uname from student_register WHERE student_id='"+student_id+"'");
        if(rs4.next())
        {
         student_uname = rs4.getString("student_uname");
           
         }
 
 ResultSet rs5=stmt.executeQuery("SELECT student_pwd from student_login WHERE student_uname='"+student_uname+"'");
        if(rs5.next())
        {
           
           student_pwd = rs5.getString("student_pwd");
           out.println(student_pwd);
         }

%>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body bgcolor="#99AAE1">
        <br>
      <center><font size="6"> <% out.println(student_name); %> </font></center>
      <center><br><br><br><br><br><font size="5" color="black">your profile is <br>updated succefully</font></center>
       
        <form action="sls" method="post">
  <input type="hidden" name="student_uname" value="<%=student_uname%>" />
            <input type="hidden" name="student_pwd" value="<%=student_pwd%>" />
        <input type="submit"  value="back" /></form>
       
    </body>
</html>
